#include "SpriteManager.h"

CSpriteManager *CSpriteManager::Instance = new CSpriteManager();

CSpriteManager::CSpriteManager(void)
{
}


CSpriteManager::~CSpriteManager(void)
{
}

void CSpriteManager::LoadSprite(LPD3DXSPRITE &SpriteHandler)
{
	_Turret = new CSprite(SpriteHandler, L"resources\\Turret.png", 64, 64, 14, 14, D3DCOLOR_XRGB(255,0,255));
	_SuperTurret = new CSprite(SpriteHandler, L"resources\\SuperTurret.png", 64, 64, 5, 5, D3DCOLOR_XRGB(255,0,255));
	_PowerUp =  new CSprite(SpriteHandler, L"resources\\PowerUp.png", 40, 25, 6, 6, D3DCOLOR_XRGB(255,0,255));	
	_WeaponCapsule = new CSprite(SpriteHandler, L"resources\\WeaponCapsule.png", 40, 25, 1, 1, D3DCOLOR_XRGB(255,0,255));
	_Bullet = new CSprite(SpriteHandler, L"resources\\bullet.png", 28, 28, 11, 11, D3DCOLOR_XRGB(255, 255, 255));
	_Explosion[0] = new CSprite(SpriteHandler, L"resources\\Explosion\\Explosion1.png", 48, 48, 1, 1, D3DCOLOR_XRGB(255, 0, 255));
	_Explosion[1] = new CSprite(SpriteHandler, L"resources\\Explosion\\Explosion2.png", 56, 56, 1, 1, D3DCOLOR_XRGB(255, 0, 255));
	_Explosion[2] = new CSprite(SpriteHandler, L"resources\\Explosion\\Explosion3.png", 64, 64, 1, 1, D3DCOLOR_XRGB(255, 0, 255));
	_BigExplosion[0] = new CSprite(SpriteHandler, L"resources\\Explosion\\BigExplosion1.png", 30, 36, 1, 1, D3DCOLOR_XRGB(255, 0, 255));
	_BigExplosion[1] = new CSprite(SpriteHandler, L"resources\\Explosion\\BigExplosion2.png", 46, 54, 1, 1, D3DCOLOR_XRGB(255, 0, 255));
	_BigExplosion[2] = new CSprite(SpriteHandler, L"resources\\Explosion\\BigExplosion3.png", 60, 60, 1, 1, D3DCOLOR_XRGB(255, 0, 255));
}

CSpriteManager *CSpriteManager::getInstance()
{
	return Instance;
}

CSprite *CSpriteManager::GetEnemySprite(Enemy Type)
{
	switch (Type)
	{
	case Turret:
		return _Turret;
	case SuperTurret:
		return _SuperTurret;
	default:
		break;
	}
}

CSprite *CSpriteManager::GetObjectSprite(Object Type)
{
	switch (Type)
	{
	case Object::PowerUp:
		return _PowerUp;
	case Object::WeaponCapsule:
		return _WeaponCapsule;
	case Object::Bullet:
		return _Bullet;
	default:
		break;
	}
}

CSprite *CSpriteManager::GetExplosionSprite(int Type)
{
	switch (Type)
	{
	case 0:
		return _Explosion[0];
	case 1:
		return _Explosion[1];
	case 2:
		return _Explosion[2];
	case 3:
		return _BigExplosion[0];
	case 4:
		return _BigExplosion[1];
	case 5:
		return _BigExplosion[2];
	default:
		break;
	}
}